<?php
	header("Content-type: text/html; charset=UTF-8");
	
	$user= $_POST['user'];
	$pwd = $_POST['pwd'];
	$sex = $_POST['sex'];
	$phone = $_POST['phone'];
	if(is_string($phone)){
		$phone = (int)($phone);
	};
	
	$con=mysql_connect("localhost",'root',"");
	mysql_query("set names 'utf8'"); 				//utf-8
	mysql_select_db('weixin',$con);
	mysql_query("INSERT INTO reg_tab(username,pwd,sex,phone)
	VALUES('$user','$pwd','$sex',$phone)");
	mysql_query("INSERT INTO user_tab(username,pwd)
	VALUES('$user','$pwd')");
	echo 'ok';
	mysql_close($con);
?>
